<?php session_start();

class Application_Controllers_ContactoController
{
    
    public function __construct($action) 
    {
        switch ($action) {
            case 'show':
                $this->_show();
                break;
            case 'list':
                $this->_list();
                break;
            case 'insert':
                $this->_insert();
                break;
            default:
               $this->_insert();
                break;
        }    
        
    }
    
    private function _insert()
    {
     
        $modelContacto =  new Application_Models_ContactoModel();
        $modelContacto->setNombre(trim($_POST["nombre"]));
        $modelContacto->setApellidos(trim($_POST["apellidos"]));
        $modelContacto->setSexo(trim($_POST["sexo"]));
        $modelContacto->setPrograma(trim($_POST["programa"]));
        $modelContacto->setUniversidad(trim($_POST["universidad"]));
        $modelContacto->setEmail(trim($_POST["email"])); 
        $modelContacto->setCelular(trim($_POST["celular"]));
        $modelContacto->setPais(trim($_POST["pais"])); 
        $modelContacto->setDireccion(trim($_POST["direccion"]));
        $modelContacto->setComentario(trim($_POST["comentario"]));
        
        $modelContacto->insertContacto();
        
    }
    
    private function _show()
    {
      
      $viewContacto = new Application_Views_ContactoView();
      $viewContacto->showMsj();
    }
    
    
}